﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace ProjMin.Utils {
    /// <summary>
    ///   Classe de leitura do xml de configuração
    /// </summary>
    class ConfigReader {
        private String xmlPath = "";
        private XmlTextReader xml = null;
        private XmlNode dataBaseconfig = null;
        public ConfigReader(String xmlPath) {
            this.xmlPath = xmlPath;
            this.readXmlFromPath();
        }

        private void readXmlFromPath() {
            XmlDocument doc = new XmlDocument();
            doc.Load(this.xmlPath);
            XmlElement root = doc.DocumentElement;
            XmlNodeList nodes = root.SelectNodes("//database");
            this.dataBaseconfig = nodes.Item(0);
            System.Console.WriteLine("Database Type: " + this.dataBaseconfig["database-type"].InnerText);            
        }

        public XmlNode getDbConfig() {
            return this.dataBaseconfig;
        }

    }
}
